import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

import {Api} from "../../providers/api/api";
/**
 * Generated class for the PasswordPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-password',
  templateUrl: 'password.html',
})
export class PasswordPage {

  new1 = "";


  constructor(public navCtrl: NavController, public navParams: NavParams,public api: Api ) {

  }

  ionViewDidLoad() {
    //console.log('ionViewDidLoad PasswordPage');


  }
  username;
  ngOnInit(): void{
    this.username = sessionStorage.getItem('username')
  }
  data;
  confirm(){

        var username = sessionStorage.getItem("username");
        var password = sessionStorage.getItem("pwd");
         ////console.log(username);
        // var Npassword = sessionStorage.getItem("pwdNew");
        var dataParm = {
          username : username,
          pwd: password,
          pwdNew: this.new1,
        };

        this.api.gets(dataParm).subscribe(res => {
          this.data = res;
            alert("修改成功");
        });



  }

}
